package com.foreknow.demo;

/**
 * @author shkstart
 * @create 2021-07-22 13:27
 */
public class Demo {
    public static  int[] sort(int[] a){
        int temp=0;
        for (int i = 0; i < a.length; i++) {
            for (int j = 0; j < a.length-i; j++) {
                if(a[j]>a[j+1]){
                    temp=a[j];
                    a[j]=a[j+1];
                    a[j+1]=temp;
                }
            }
        }
        return a;
    }

    public static void main(String[] args) {
        int[] arr={1,2,4,9654,8,7};
        int[] array=Demo.sort(arr);
        for (int i = 0; i < array.length; i++) {
            System.out.println(array[i]);
        }
    }
}

